var t = require("../../@babel/runtime/helpers/defineProperty"), a = getApp();

Page({
    data: {
        id: "",
        status: 0,
        getNum: 0,
        waitNum: 0,
        getListData_1: [],
        getListData_2: [],
        getListData_3: [],
        codeimg: "",
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        t.id && this.setData({
            id: t.id
        }), this.getDetail();
    },
    getDetail: function() {
        var e = this, s = a.getNetAddresss("plugin.coupon-qr.api.index.getDetail");
        a._postNetWork({
            url: s,
            showToastIn: !1,
            data: {
                status: this.data.status,
                qr_id: this.data.id
            },
            success: function(a) {
                var s = a.data;
                1 == s.result ? (e.setData({
                    getNum: s.data.getNum,
                    waitNum: s.data.waitNum,
                    total_page: s.data.last_page
                }), 1 == e.data.status ? e.setData(t({}, "getListData_2[0]", s.data.data)) : 2 == e.data.status ? e.setData(t({}, "getListData_3[0]", s.data.data)) : e.setData(t({}, "getListData_1[0]", s.data.data))) : wx.showToast({
                    icon: "none",
                    title: s.msg,
                    duration: 1500
                });
            },
            fail: function(t) {}
        });
    },
    _getMoreData: function() {
        var e = this, s = a.getNetAddresss("plugin.coupon-qr.api.index.getDetail");
        this.data.page >= this.data.total_page ? e.setData({
            isLoadMore: !1
        }) : (e.setData({
            page: e.data.page + 1
        }), a._postNetWork({
            url: s,
            showToastIn: !1,
            data: {
                page: this.data.page,
                status: this.data.status,
                qr_id: this.data.id
            },
            success: function(a) {
                var s = a.data;
                1 == s.result ? 1 == e.data.status ? e.setData(t({}, "getListData_2[" + e.data.getListData_2.length + "]", s.data.data)) : 2 == e.data.status ? e.setData(t({}, "getListData_3[" + e.data.getListData_3.length + "]", s.data.data)) : e.setData(t({}, "getListData_1[" + e.data.getListData_1.length + "]", s.data.data)) : e.setData({
                    page: e.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(t) {}
        }));
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    chooseTabchange: function(t) {
        1 == t.detail.index ? this.setData({
            status: 1
        }) : 2 == t.detail.index ? this.setData({
            status: 2
        }) : this.setData({
            status: 0
        }), this.setData({
            isLoadMore: !0,
            page: 1,
            total_page: 0,
            getListData_1: [],
            getListData_2: [],
            getListData_3: []
        }), this.getDetail();
    },
    gosmall_qr: function(t) {
        var a = t.currentTarget.dataset.smallqr;
        this.setData({
            codeimg: a,
            showcode: !0
        });
    },
    showcodecloseBtn: function() {
        this.setData({
            showcode: !1
        });
    }
});